
export default {
	//异步保存
	setStorage(key="token",data="123"){
		uni.setStorage({
		    key,
		    data,
		    success: ()=>{

		    },
			fail: () => {

			}
		});
	},
	//同步保存
	setStorageSync(key,data){
		  uni.setStorageSync(key, data);
	},
	//异步获取
	getStorage(key,cb){
		uni.getStorage({
		    key,
		    success: res=> {
		       return cb&&cb(res.data);
		    },
			fail:e=>{

			}
		});
	},
	//同步获取
	getStorageSync(key){
		 const value = uni.getStorageSync(key);
		 return value
	},
	//异步删除
	removeStorage(key,cb){
		uni.removeStorage({
		    key,
		    success: function (res) {
		       return cb&&cb(res)
		    }
		});
	},
	//同步删除
	removeStorageSync(key){
		   uni.removeStorageSync(key);
	},
	//异步清空所有
	clearStorage(){
		uni.clearStorage();
	},
	//同步清空所有
	clearStorageSync(){
		 uni.clearStorageSync();
	}
}
